package shapes.shapes2D 
{
	import flash.display.Graphics;
	import flash.geom.Rectangle;
	/**
	 * ...
	 * @author Nicolas Barradeau
	 * http://en.nicoptere.net
	 */
	public class Quad extends BaseShape
	{
		private var _rect:Rectangle;
		public function Quad( rect:Rectangle ) 
		{
			
			this.rect = rect.clone();
			
		}
		
		
		public function draw( graphics:Graphics = null ):void
		{
			
			if ( graphics == null ) 
			{
				
				graphics = this.graphics;
				graphics.clear();
				graphics.lineStyle( strokeWidth, strokeColor, strokeAlpha );
				
				graphics.beginFill( fillColor, fillAlpha );
				graphics.drawRect( -rect.width / 2, -rect.height / 2, rect.width, rect.height );
				graphics.endFill();
				
				
			}
			else
			{	
				graphics.drawRect( x + rect.x-rect.width / 2, y + rect.y-rect.height / 2, rect.width, rect.height );
			}
		}
		
		
		public function get rect():Rectangle { return _rect; }
		
		public function set rect(value:Rectangle):void 
		{
			_rect = value;
		}
		
	}

}